<template>
  <el-card class="mod-student-myinfo">
    <div >
      <el-form :model="studentData"
            label-width="120px">
            <el-form-item label="学号:" prop="sid" >
                <div >
                  {{ studentData.sid }}
                </div>
            </el-form-item>
            <el-form-item label="姓名:" prop="name">
                <div>
                  {{ studentData.name }}
                </div>
            </el-form-item>

            <el-form-item label="联系方式:" prop="mobile">
                <div>
                  {{ studentData.mobile }}
                </div>
            </el-form-item>

            <el-form-item label="身份证号码:" prop="certNo">
                <div >
                  {{studentData.certNo}}
                </div>
            </el-form-item>

            <el-form-item label="籍贯:" prop="local">
                <div>
                  {{ studentData.local }}
                </div>
            </el-form-item>
            <el-form-item label="政治面貌:" prop="political">
              <div  readonly>{{studentData.political}}
              </div>
            </el-form-item>
            <el-form-item label="专业班级:" prop="political">
              <div >
                {{ studentData.dept.deptName+'-'+studentData.major.majorName+'-'+studentData.classCode }}
              </div>
            </el-form-item>
            <el-form-item label="宿舍:" prop="political">
              <div>
                {{ studentData.roomName+'-'+studentData.bedId }}
              </div>
            </el-form-item>
            
            </el-form>
     
      
    </div>
    
  </el-card>

</template>

<script>
 
import { classApi, roomApi } from '@/api/baseinfo'
import { studentApi } from '@/api/student'
  export default {
    data () {
      return {
        dataForm: {
          studentId: '',
          cid:'',
          type:''
        },
        studentData: {},
        
        dataListLoading: false,
        
      }
    },
    components: {
      
    },
    created () {
      this.getDataList()
    },
    methods: {
      // 获取数据列表
      getDataList () {
        this.dataListLoading = true

        studentApi.getmyInfo()
        .then(({data}) => {
          data.roomName=""
          this.studentData = data
      
          this.dataListLoading = false
          return roomApi.getRoomInfo(data.roomId)
        })
        //获取宿舍信息
        .then(({room})=>{
          this.studentData.roomName=room.roomNumber
          return roomApi.getRoomInfo(room.parentId)
        })
        .then(({room})=>{
          this.studentData.roomName=room.roomNumber+'-'+this.studentData.roomName
          console.log(this.studentData);
        })
        //获取班级、学院信息
        
      }
    }
  }
</script>
<style lang="scss" >
.mod-student-myinfo{
  max-width: 600px ;
  min-width:600px;
  margin: auto;
  .el-form-item{
    margin-bottom: 10px !important;
  }
  .el-form-item__content{
    div{
      text-align: left;
      font-size: 14px;
      color: #606266;
      font-weight: 700;
      margin-left: 10px;
    }
  }
}

</style>
